package com.CST.util;

import com.CST.entity.cb.BdSysMenu;


import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

/**
 * <p></p>
 *
 * @author: y
 * @create: 2021-10-13 14:07
 **/

public class uitl {

    public static void  treePower(List<BdSysMenu> list, BdSysMenu bsSelf){

        List<BdSysMenu>  children=new ArrayList();
        for (int i=0; i<list.size(); i++) {
            if(list.get(i).getParentId().equals(bsSelf.getId())){
                 treePower(list,list.get(i));
                children.add(list.get(i));
            }
        }
        bsSelf.setChildNodes(children);
    }
/*
    public static void main(String[] args) {
        List<BdSysMenu>  list=new ArrayList();
        BdSysMenu b1=new BdSysMenu();
        b1.setId("1");
        b1.setMenuName("a");
        b1.setParentId("0");
        BdSysMenu b2=new BdSysMenu();
        b2.setId("2");
        b2.setMenuName("b");
        b2.setParentId("0");
        BdSysMenu b11=new BdSysMenu();
        b11.setId("11");
        b11.setMenuName("c");
        b11.setParentId("1");
        BdSysMenu b111=new BdSysMenu();
        b111.setId("111");
        b111.setMenuName("d");
        b111.setParentId("11");
        BdSysMenu b21=new BdSysMenu();
        b21.setId("21");
        b21.setMenuName("e");
        b21.setParentId("2");


        list.add(b1);
        list.add(b11);
        list.add(b111);
        list.add(b2);
        list.add(b21);

        BdSysMenu root=new BdSysMenu();
        root.setId("0");
        root.setMenuName("root");

        treePower(list,root);

        System.out.println(root);


    }

 */


    public static void main(String[] args) {
        Calendar cal = Calendar.getInstance();
        int day = cal.get(Calendar.DATE);
        int month = cal.get(Calendar.MONTH) + 1;
        int year = cal.get(Calendar.YEAR);
        int dow = cal.get(Calendar.DAY_OF_WEEK);
        int dom = cal.get(Calendar.DAY_OF_MONTH);
        int doy = cal.get(Calendar.DAY_OF_YEAR);

        System.out.println("当期时间: " + cal.getTime());
        System.out.println("日期: " + day);
        System.out.println("月份: " + month);
        System.out.println("年份: " + year);
        System.out.println("一周的第几天: " + dow);  // 星期日为一周的第一天输出为 1，星期一输出为 2，以此类推
        System.out.println("一月中的第几天: " + dom);
        System.out.println("一年的第几天: " + doy);
    }








}
